<?php
registerTable("manager_classes", new table_manager_classes());

class table_manager_classes extends Database
{

    public function __construct()
    {
        parent::__construct("manager_classes");
    }

    public function fetch_all_classes()
    {
        return $this->fetch_all_assoc("1=1", "*");
    }

    public function fetch_by_classid($classid)
    {
        return $this->fetch_assoc("`classid`=$classid", "*");
    }

    public function fetch_classid_by_master($master)
    {
        return $this->fetch_assoc("`master`=$master", "`classid`");
    }

    public function fetch_enabled_classes()
    {
        return $this->fetch_all_assoc("`enable`=1");
    }
    public function fetch_stu_num($classid)
    {
        return $this->fetch_assoc_by_sql("SELECT COUNT(*) AS stu_num FROM `manager_student` WHERE `classid`=$classid")["stu_num"];
    }
}
?>